/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.cvut.fel.taskpro.data.imanager;

import cz.cvut.fel.taskpro.data.entity.Kantor;
import cz.cvut.fel.taskpro.data.entity.Student;
import cz.cvut.fel.taskpro.data.entity.Subject;
import java.io.Serializable;
import java.util.List;
import javax.ejb.Local;

/**
 * This local interface specify database responsible action of data manager,
 * which is responsible for working with subjects.
 *
 * @author Tom
 * @version 1.0.0. beta
 */
@Local
public interface ISubjectData extends Serializable {
    /**
     * This method add subject to database.
     * @param subject subject to add to database.
     */
    public void addSubject(Subject subject);
    /**
     * This method find subject in database based on code.If no subject is 
     * founded, then return null.
     * @param code code of subject to find.
     * @return subject by code.If no subject is founded, then return null.
     */
    public Subject getSubjectByCode(String code);
    /**
     * This method find in database all subjects. During this method all entities are refreshed.
     * @return <code>List</code> of subjects in database
     */
    public List<Subject> getAllSubject();
    /**
     * This method update subject to database.
     * @param subject subject to update.
     */
    public void updateSubject(Subject subject);
/**
 * This method return all subjects which teach kantor in parameter.
 * @param kantor kantor who teach subject.
 * @return <code>List</code> of subjects which teach kantor, if no subjects is founded then return
 * empty list. Subjects are order by code.
 */
    public List<Subject> getSubjecByKantor(Kantor kantor);

    /**
     * This method return all students which are registerd in specific subject.
     * Subject group is not being consider.
     *
     * @param subject subjects by which will be students find.
     * @return <code>List</code> of students ordere by login, which are registred in specific
     * subject.
     */
    public List<Student> getStudentsInSubject(Subject subject);

    /**
     * This method find all subject where is registred specific student.
     * Registred mean, that student is in a group which is associated with any
     * subject.
     *
     * @param student students by whom will be found subjects, in which he
     * is part of.
     * @return <code>List</code> of subjects asc by code, where is student registred
     */
    public List<Subject> getStudentsSubject(Student student);
    /**
     * This method refresh all subjects in db.
     * @param subjectToRefresh subjects to refreshed.
     */
    public void refreshAllSubjects(Subject subjectToRefresh);
}
